home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / amiga / asrc29k.lha / files.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  3.3 KB  |  94 lines

  1. /* System-dependent definitions of various files, spool directories, etc */
  2. #include "global.h"
  3. #include "files.h"
  4.  
  5. char *Startup        = "NOS-Startup";
  6. char *NOSDial        = "NOS-Dial";
  7. char *Config        = "Config.NOS";            /* Device configuration list */
  8. char *Hostfile        = "NOS.rc";
  9. char *Userfile        = "FTPusers";
  10. char *LogsDir        = "Logs";
  11. char *Mailspool        = "Spool/Mail";
  12. char *Mailqdir        = "Spool/Mqueue";
  13. char *Mailqueue        = "Spool/Mqueue/#?.WRK";
  14. char *Routeqdir        = "Spool/Rqueue";        /* queue for router */
  15. char *Alias        = "Alias";            /* the alias file */
  16. char *Dfile        = "Domain.TXT";            /* Domain cache */
  17. char *Fdir        = "Finger";            /* Finger info directory */
  18. char *Arealist        = "Spool/Areas";        /* List of message areas */
  19. char *Helpdir        = "Spool/Help";            /* help file directory */
  20. char *Rewritefile    = "Spool/Rewrite";         /* Address rewrite file */
  21. char *Signature        = "Spool/Signature";        /* Mail signature file directory */
  22. char *Popusers        = "POPusers";            /* POP user and password file */
  23. char *Newsdir        = "Spool/News";            /* News messages and NNTP data */
  24. char *Newsqueue        = "Spool/News/#?.WRK";
  25. char *Forwardfile    = "Spool/Forward.BBS";        /* Mail forwarding file */
  26. char *Historyfile    = "Spool/History";        /* Message ID history file */
  27. char *Chatnode        = "Chatnode.CFG";        /* Chatnode */
  28. char *SignOn        = "Spool/Signon";        /* SignOn files Mbox, FTP, TTY. */
  29. char *Digger        = "Digger";            /* where Digger topics are held */
  30. char *DiggerC        = "Digger/Cache";        /* where Digger topics are held */
  31. char *Spoolqdir        = "Spool";
  32.  
  33. #define    SEPARATOR    ":"
  34.  
  35. static char *strcatdup __ARGS((char *a,char *b,char *c));
  36.  
  37. /* Establish a root directory other than the default. Can only be called
  38.  * once, at startup time
  39.  */
  40. void initroot(root)
  41. char *root;
  42. {
  43.     Startup = strcatdup(root,SEPARATOR,Startup);
  44.     NOSDial = strcatdup(root,SEPARATOR,NOSDial);
  45.     Userfile = strcatdup(root,SEPARATOR,Userfile);
  46.     Hostfile = strcatdup(root,SEPARATOR,Hostfile);
  47.     LogsDir = strcatdup(root,SEPARATOR,LogsDir);
  48.     Mailspool = strcatdup(root,SEPARATOR,Mailspool);
  49.     Mailqdir = strcatdup(root,SEPARATOR,Mailqdir);
  50.     Mailqueue = strcatdup(root,SEPARATOR,Mailqueue);
  51.     Routeqdir = strcatdup(root,SEPARATOR,Routeqdir);
  52.     Alias = strcatdup(root,SEPARATOR,Alias);
  53.     Dfile = strcatdup(root,SEPARATOR,Dfile);
  54.     Fdir = strcatdup(root,SEPARATOR,Fdir);
  55.     Arealist = strcatdup(root,SEPARATOR,Arealist);
  56.     Helpdir = strcatdup(root,SEPARATOR,Helpdir);
  57.     Rewritefile = strcatdup(root,SEPARATOR,Rewritefile);
  58.     Signature = strcatdup(root,SEPARATOR,Signature);
  59.     Popusers = strcatdup(root,SEPARATOR,Popusers);
  60.     Newsdir = strcatdup(root,SEPARATOR,Newsdir);
  61.     Newsqueue = strcatdup(root,SEPARATOR,Newsqueue);
  62.     Forwardfile = strcatdup(root,SEPARATOR,Forwardfile);
  63.     Historyfile = strcatdup(root,SEPARATOR,Historyfile);
  64.     Chatnode = strcatdup(root,SEPARATOR,Chatnode);
  65.     SignOn = strcatdup(root,SEPARATOR,SignOn);
  66.     Digger = strcatdup(root,SEPARATOR,Digger);
  67.     DiggerC = strcatdup(root,SEPARATOR,DiggerC);
  68.     Spoolqdir = strcatdup(root,SEPARATOR,Spoolqdir);
  69. }
  70.  
  71. /* Concatenate three strings into a malloc'ed output buffer */
  72. static char *strcatdup(a,b,c)
  73. char *a,*b,*c;
  74. {
  75.     char *out,*p1,*p2;
  76.  
  77.     out = mallocw(strlen(a) + strlen(b) + strlen(c) + 1);
  78.     strcpy(out,a);
  79.     strcat(out,b);
  80.     strcat(out,c);
  81.     if(*b != '\0'){
  82.         /* Remove any repeated occurrences of the separator char */
  83.         p1 = p2 = out;
  84.         while(*p2 != '\0'){
  85.             *p1++ = *p2++;
  86.             while(p2[0] == p2[-1] && p2[0] == b[0])
  87.                 p2++;
  88.         }
  89.         *p1 = '\0';
  90.     }
  91.     return out;
  92. }
  93.  
  94.